<%// Copyright 2008 Carnegie Mellon University
// Licensed under the Apache License, Version 2.0 (the "License"); 
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//  
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, 
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.%>
<!-- These two are the must -->
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page pageEncoding="UTF-8" %>

<%@page import="java.util.List"%>
<%@page import="edu.cmu.lti.sepia.data.db.SQL"%>
<%@page import="edu.cmu.lti.sepia.infra.system.model.User"%>
<%@page import="edu.cmu.lti.sepia.servlet.Downloader"%>
<%@page import="edu.cmu.lti.sepia.servlet.Commons"%>
<%@page import="edu.cmu.lti.sepia.data.db.UserDAO"%>

<%
out.println( Commons.getHeader(request, response, "Downloader for Admin", 1) );

SQL sql = new SQL();
%>

<br><h4>List of files each account can access</h4>
Under each account name, there are files it has access to. 
The list includes xml file submitted by that account.
<br>
To download, select files by filling in the check boxes 
then click on the download button.<br><br><br>
<form action="../io/downloader.html" method="POST" name="dl_form">

<% 
try {
  List<User> users = UserDAO.getUsers(sql);
  for (User user : users) {
    out.println( "<strong>"+user.getUserName()+"</strong>&nbsp;&nbsp;&nbsp;&nbsp;" );    
    out.println( Downloader.listMySubmission( sql, user.getUserId(), -1 ) );
    out.println( "<br>" );
  }
  out.println(Downloader.getButton());
} catch (Exception e) {
  
} finally {
  try {
    sql.close();
  } catch (Exception e){e.printStackTrace();}
}
%>
</form>
<%
out.println( Commons.getFooter(request, response));
%>
